package net.pulseproject.commons.misc.preferences;

import java.awt.Dimension;
import java.awt.Point;

public abstract class PreferencesField<T> {
	
	public static final PreferencesField<String> RECENT_CONFIG_TEXT =
		new PreferencesStringField("RECENT_CONFIG_TEXT", "");

//	public static final PreferencesField<String> PORT_FILTER =
//		new PreferencesStringField("PORT_FILTER", "");

	public static final PreferencesField<Point> RECENT_WINDOW_POSITION =
		new PreferencesPointField("RECENT_WINDOW_POSITION", null);
	
	public static final PreferencesField<Dimension> RECENT_WINDOW_DIMENSION =
		new PreferencesDimensionField("RECENT_WINDOW_DIMENSION", null);

	
	private final String key;
	
	private final T defaultValue;
	
	
	protected PreferencesField(final String key, final T defaultValue) {
		this.key = key;
		this.defaultValue = defaultValue;
	}
	
	protected final String getKey() {
		return this.key;
	}
	
	protected final T getDefaultValue() {
		return this.defaultValue;
	}

	protected abstract T getValue(PreferencesDataAccessor preferencesData);

	protected abstract void setValue(PreferencesDataAccessor preferencesData, T value);
	
}
